package org.ax.service.employ.imple;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.ax.mapper.employ.DepartmentMapper;
import org.ax.pojo.employ.Department;
import org.ax.pojo.employ.Employee;
import org.ax.service.employ.DepartmentService;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

/**
 * 编程人:赵浩鑫
 * 时间:2021-03-02-21:51
 */
@Service
public class IDepartmentService extends ServiceImpl<DepartmentMapper, Department> implements DepartmentService {
    @Override
    public Page<Department> findDepartmentList(Page page) {
        return getBaseMapper().selectPage(page, null);
    }

    @Override
    public boolean addDepartment(Department department) {
        return getBaseMapper().insert(department)>0;
    }

    @Override
    public boolean updateDepartment(Department department) {
        return getBaseMapper().updateById(department)>0;
    }

    @Override
    public boolean deletesDepartment(String[] ids) {
        return getBaseMapper().deleteBatchIds(Arrays.asList(ids))>0;
    }

    @Override
    public Department toDepartmentId(String id) {
        return getBaseMapper().selectById(id);
    }

    @Override
    public List<Department> availableDepartment() {
        return getBaseMapper().selectList(null);
    }
}
